import React from 'react';
import { StyleSheet, Text, View, Button } from 'react-native';
import Index from './src/pages/index/Index'
import List from './src/pages/list/List'
import Detail from './src/pages/detail/Detail'
import { Provider } from 'mobx-react'
import store from '@/src/store/index'
import { NavigationContainer } from '@react-navigation/native';
import { createStackNavigator } from '@react-navigation/stack';
// import * as WeChat from 'react-native-wechat';

// WeChat.registerApp('appid');

const Stack = createStackNavigator()

export default function App() {

  const handleShare= async ()=>{
    // let result = await WeChat.shareToTimeline({
    //   type: 'text', 
    //   description: 'hello, wechat'
    // });
  }

  return (
    <NavigationContainer>
      <Provider store={store}>
        <Stack.Navigator
          screenOptions={{
            headerStyle: {
              backgroundColor: "#ff6c05"
            },
            headerTintColor: 'white',
            headerTitleStyle: {
              color: "white",
              fontWeight: "300",
              fontSize: 20
            }

          }}
        >
          <Stack.Screen name="Index" component={Index}
            options={{
              title: "菜谱大全"
            }}
          />

          <Stack.Screen name="List" component={List} options={{
            title: "分类"
          }} />

          <Stack.Screen name="Detail" component={Detail} options={{
            title: "详情",
            headerRight: () => {
              return (
                <View style={{paddingRight:10}}>
                  <Button
                    title="分享" onPress={() => {
                      handleShare()
                    }}></Button>
                </View>

              )
            }
          }} />



        </Stack.Navigator>
      </Provider>
    </NavigationContainer>


  );
}

